# -*- coding: utf-8 -*-
"""
Created on Thu Aug 21 16:42:19 2014

@author: loseair123
"""

'''
#python当中字符串的定义与切片

str1='abcdefg'
str2="abc\"defg"
str3="""abc

defg"""
print(str1)
print(str2)
print(str3)

#切片
print(str1[0],str1[1])
print(str1[:3])
print(str1[3:])
print(str1[1:3])
print(str1[1:6:2])
print(str1[6:1:-1])
print(str1[-6:-3])

#字符串和元组操作

str1='abcdef'
str2='123456'
print(len(str1))
print(str1+str2)
print('a' in str1)
print(cmp(str1,str2))
print(max(str2))
print(min(str2))

#元组操作

t=(1,)
student=("Eko",24,"Male")
print(student[0])
print(student[1])
print(student[2])
print(student[:2])
name,age,sex=("Eko",24,"Male")
print(name,age,sex)


#列表

person=['eko',22,'male','nus','ece']
print(person)
person.append('handsome')
print(person)
person.remove(22)
print(person)
del(person[1])
print(person)
'''
#字典操作 

person={'name':'eko','sex':'male','age':22}
print(person['name'])
print(person['age'])

#添加字典
person['tel']=82842263
print(person)
print(person.values())
print(person.has_key('sex'))
print(person.get('sex'))
print(person.get('wight',"error"))
person.pop('tel')
person.clear()
del(person)
